package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eItemId;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.server.manger.activity.drawPictures.DrawPicturesActivityMgr;

import java.util.ArrayList;
import java.util.List;

public class DrawPicturesRecycleStrategy extends AbstractItemRecycleStrategy {
    @Override
    public void markNeedRecycleItem() {
        List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DrawPicturesActivity.getValue());
        for (ActivityInfo activityInfo : openActivityInfoList) {
            if (activityInfo != null) {
                int activityConsumeId = DrawPicturesActivityMgr.getActivityConsumeId(activityInfo);
                long recycleTime = activityInfo.getEndTime() * 1000L + 600 * 1000;
                List<String> paramList = new ArrayList<>();
                paramList.add(String.valueOf(activityConsumeId));
                paramList.add(String.valueOf(DrawPicturesActivityMgr.getActivityScoreId(activityInfo)));
                paramList.add("0");
                paramList.add(activityInfo.getActivityName());
                ActivityItemRecycleMgr.addRecycleItemData(activityConsumeId, activityType, 1, recycleTime, paramList);
            }
        }
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.DrawPicturesActivity.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        item2Score(userId, data, MailManager.ACTIVITY_GOODS_AUTO_CONSUME_TITLE, MailManager.ACTIVITY_GOODS_AUTO_CONSUME_CONTENT);
    }

    @Override
    public boolean isActivityRunning() {
        return false;
    }
}
